Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update quick-sort.md #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

manikanta-manii
Copy link

Previous code was having Array Index Bound Error in it , so i made changes in code . Changes made are:

  1. pointer i was incrementing if arr[i] is less than or equal to pivot
    this was leading it cross the boundary , which is at that iteration i will be greater than high . then again while checking condition it was trying to access the high'th element which was giving "Array Index Out Of Bound" error .
    solution : if ( i<=high && arr[i] <=pivot ) then i++ ;

similarly for j pointer : if(j>=low && arr[j] >=pivot) then j-- ;

📌📌 please update this in your web page ........
❤️❤️ If possible give some credit :

https://github.com/manikanta-manii

Previous code was having Array Index Bound Error in it , so i made changes in code .
Changes made are:

1. pointer i was incrementing if arr[i] is less than or equal to pivot 
this was leading it cross the boundary , which is at that iteration i will be greater than high . then again while checking condition it was trying to access the high'th element which was giving "Array Index Out Of Bound"   error .
solution : if ( i<=high && arr[i] <=pivot ) then i++ ;

similarly for j pointer : if(j>=low && arr[j] >=pivot) then j-- ;


📌📌  please update this in your web page ........
❤️❤️   If possible give some credit :
            
https://github.com/manikanta-manii
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant